package com.qk.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    /*
    1. 部门列表查询
    */
    List<Role> selectList(String name, String label);

    /*
    2. 删除角色
    */
    @Delete("delete from role where id=#{id}")
    void delete(Integer id);

    /*
    3. 新增角色
    */
    @Insert("insert into role(name,label,remark,create_time,update_time) values(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void insert(Role role);

    /*
    4. 修改角色
    */
    void update(Role role);

    /*
    5. 查询所有角色
    */
    @Select("select  id, name, label, remark, create_time, update_time from role ")
    List<Role> listAll();
     /*
    6. 根据id查询角色
    */
    @Select("select id, name, label, remark, create_time, update_time from role where id= #{id}")
    Role selectByid(Integer id);
}
